$.get('../php/goods.php',{'floor':1},res=>{
    var {meta:{status,msg},data} = res;
    if(status === 1){
        var str = '';
        data.forEach(iterm=>{
            str +=`
            <div class="pro-text-box1 fl row">
            <a href="../html/detail.html?id=${iterm.id}">
            <img class="pic5-2" src="${iterm.imgpath.split('==========')[0]}" alt="">
            <p class="pic5-t1">${iterm.name}</p>
            <p class="pic5-t2">CPU全面屏</p>
            <p class="pic5-t3">4999元起</p>
        </a>
            </div>
            
            `
        })
        $('.floor1 .row').html(str)
    }
},'json')

// 2楼
$.get('../php/goods.php',{'floor':2},res=>{
    var {meta:{status,msg},data} = res;
    if(status === 1){
        var str = '';
        data.forEach(iterm=>{
            str +=`
            <div class="pro-text-box2 fl row">
            <a href="../html/detail.html?id=${iterm.id}">
            <img class="pic5-2" src="${iterm.imgpath.split('==========')[0]}"}" alt="">
            <p class="pic5-t1">${iterm.name}</p>
            <p class="pic5-t2">CPU全面屏</p>
            <p class="pic5-t3">4999元起</p>
        </a>
            </div>
            
            `
        })
        $('.floor2 .row').html(str)
    }
},'json')

// 3楼
$.get('../php/goods.php',{'floor':3},res=>{
    var {meta:{status,msg},data} = res;
    if(status === 1){
        var str = '';
        data.forEach(iterm=>{
            str +=`
            <div class="pro-text-box2 fl row">
            <a href="../html/detail.html?id=${iterm.id}">
            <img class="pic5-2" src="${iterm.imgpath.split('==========')[0]}"}" alt="">
            <p class="pic5-t1">${iterm.name}</p>
            <p class="pic5-t2">CPU全面屏</p>
            <p class="pic5-t3">4999元起</p>
        </a>
            </div>
            
            `
        })
        $('.floor3 .row').html(str)
    }
},'json')

// 4楼
$.get('../php/goods.php',{'floor':4},res=>{
    var {meta:{status,msg},data} = res;
    if(status === 1){
        var str = '';
        data.forEach(iterm=>{
            str +=`
            <div class="pro-text-box2 fl row">
                <a href="../html/detail.html?id=${iterm.id}">
                    <img class="pic5-2" src="${iterm.imgpath.split('==========')[0]}"}" alt="">
                    <p class="pic5-t1">${iterm.name}</p>
                    <p class="pic5-t2">CPU全面屏</p>
                    <p class="pic5-t3">4999元起</p>
                </a>
            </div>
            
            `
        })
        $('.floor4 .row').html(str)
    }
},'json')

// 5楼
$.get('../php/goods.php',{'floor':5},res=>{
    var {meta:{status,msg},data} = res;
    if(status === 1){
        var str = '';
        data.forEach(iterm=>{
            str +=`
            <div class="pro-text-box2 fl row">
                <a href="../html/detail.html?id=${iterm.id}">
                    <img class="pic5-2" src="${iterm.imgpath.split('==========')[0]}"}" alt="">
                    <p class="pic5-t1">${iterm.name}</p>
                    <p class="pic5-t2">CPU全面屏</p>
                    <p class="pic5-t3">4999元起</p>
                </a>
            </div>
            
            `
        })
        $('.floor5 .row').html(str)
    }
},'json')

// 6楼
$.get('../php/goods.php',{'floor':6},res=>{
    var {meta:{status,msg},data} = res;
    if(status === 1){
        var str = '';
        data.forEach(iterm=>{
            str +=`
            <div class="pro-text-box2 fl row">
            <a href="../html/detail.html?id=${iterm.id}">
                <img class="pic5-2" src="${iterm.imgpath.split('==========')[0]}"}" alt="">
                <p class="pic5-t1">${iterm.name}</p>
                <p class="pic5-t2">CPU全面屏</p>
                <p class="pic5-t3">4999元起</p>
            </a>
                
            </div>
            
            `
        })
        $('.floor6 .row').html(str)
    }
},'json')

// 楼层跳转
$('.ding1:lt(6)').click(function(){
    // 获取属性
    var classname = $(this).attr('data-class')
    var t = $('.'+classname).offset().top
    console.log(t);
    $('html,body').animate({
        scrollTop:t
    },2000)
    return false;

})

$('.ding1:last').click(function(){
    $('html,body').animate({
        scrollTop:0
    },2000,'linear')
    return false;
})
